package com.sugon.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.sugon.dao.ToolsCheckJudgeStandardDao;
import com.sugon.entity.ToolsCheckJudgeStandardEntity;
import com.sugon.service.ToolsCheckJudgeStandardService;
import com.sugon.utils.Constant;
import com.sugon.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 工装精度检测判定标准Service实现类
 *
 * @author YuXD
 * @date 2021-09-22
 */
@Service("toolsCheckJudgeStandardService")
public class ToolsCheckJudgeStandardServiceImpl implements ToolsCheckJudgeStandardService {
    @Autowired
    private ToolsCheckJudgeStandardDao toolsCheckJudgeStandardDao;

    @Override
    public ToolsCheckJudgeStandardEntity queryObject(String id) {
        return toolsCheckJudgeStandardDao.queryObject(id);
    }

    @Override
    public List<ToolsCheckJudgeStandardEntity> queryList(Map<String, Object> map) {
        return toolsCheckJudgeStandardDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return toolsCheckJudgeStandardDao.queryTotal(map);
    }

    @Override
    public int save(ToolsCheckJudgeStandardEntity toolsCheckJudgeStandard) {
        toolsCheckJudgeStandard.setId(RandomUtil.randomString(32));
        toolsCheckJudgeStandard.setGmtCreate(DateUtil.date());
        toolsCheckJudgeStandard.setCreateUser(ShiroUtils.getUserId());
        toolsCheckJudgeStandard.setDelFlag(Constant.IS_NOT_DEL_INT);
        return toolsCheckJudgeStandardDao.save(toolsCheckJudgeStandard);
    }

    @Override
    public int update(ToolsCheckJudgeStandardEntity toolsCheckJudgeStandard) {
        toolsCheckJudgeStandard.setGmtModified(DateUtil.date());
        toolsCheckJudgeStandard.setModifyUser(ShiroUtils.getUserId());
        return toolsCheckJudgeStandardDao.update(toolsCheckJudgeStandard);
    }

    @Override
    public int delete(String id) {
        return toolsCheckJudgeStandardDao.delete(id);
    }

    @Override
    public int deleteBatch(String[] ids) {
        return toolsCheckJudgeStandardDao.deleteBatch(ids);
    }
}
